def func1(x):
    return True if x % 2 == 1 else False
if __name__ == '__main__':
    # 普通函数的写法
    nums = [1, 2, 3, 4, 5, 6]
    result = filter(func1, nums)
    print(list(result))  # [1, 3, 5]
    # 匿名函数的写法
    result = filter(lambda x: True if x % 2 == 1 else False, nums)
    print(list(result))  # [1, 3, 5]
    result = filter(lambda x: True if x > 3 else False, nums)
    print(list(result))  # [4, 5, 6]

